package org.dydl.service.system.impl;

import java.util.List;

import org.dydl.common.dto.ResponseMessage;
import org.dydl.dao.system.repository.IAreaProductListRepository;
import org.dydl.model.system.AreaProductList;
import org.dydl.model.system.vo.AreaProductVO;
import org.dydl.service.system.AreaProductListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**  
 * @ClassName: BusinessListServiceImpl  
 * @Description: TODO(这里用一句话描述这个类的作用)  
 * @author 55436  
 * @date 2019年12月19日    
 */
@Service
public class AreaProductListServiceImpl implements AreaProductListService {
	
	@Autowired
	private IAreaProductListRepository areaRepository;
	
	
	
	private ResponseMessage res = new ResponseMessage();



	/* (non-Javadoc)
	 * @see org.yorma.service.system.IAreaService#list(java.lang.Integer)
	 */
	@Override
	public List<AreaProductList> list(Integer areaId ,String businessId) {
		// TODO Auto-generated method stub
		
		List<AreaProductList> list = areaRepository.getAreaProductList(areaId ,businessId);
		
		return list;
	}



	@Override
	public List<AreaProductList> get(String name) {
		
		List<AreaProductList> list = areaRepository.get(name);
		
		return list;
	}



	@Override
	public ResponseMessage saveAreaProduct(List<AreaProductList> arr) {
		
		List<AreaProductList> list = arr;
		
		
		try {
			areaRepository.save(list);
			res.setSuccess(true);
		} catch (Exception e) {
			res.setSuccess(false);
			res.setMsg(e.getMessage());
		}
		
		return res;
	}



	

	

}
